
<?php
$page = new Libs_splitPage($this->listAllApp, 10);
?>
<h3>Danh sách ứng dụng</h3>
<b><a href="<?php echo URL_BASE ?>/admin/apps/form">Thêm ứng dụng</a> ---
    <a href="<?php echo URL_BASE ?>/admin/apps?status=0">Ứng dụng chưa đăng</a>
   </b>
<table cellpadding="5" cellspacing="0" border="1">
    <thead>
        <tr>
            <td colspan="12">
                <form method="get" action="">
                Search: <input type="text" name="search" placeholder="Search..." id="txtSearch" class="required"/>
                <input type="submit" value="Tìm kiếm" id="btnSearch"/>
                </form>
            </td>
        </tr>
        <tr>
            
            <th>ID</th>
            <th>Tên ứng dụng</th>
            <th>Ảnh</th>
            <th>Thời gian cập nhật</th>
            <th>Phiên bản</th>
            <th>Yêu cầu phần cứng</th>
            <th>Chuyên mục</th>
            <th>Kích thước</th>
            <th>Đường dẫn</th>
            <th>Điểm</th>
            <th>Chức năng</th>
        </tr>
    </thead>
    <tbody>
        <?php
        $app = new Admin_Models_tblApps();
        $dataPage = array();
        if (isset($_GET['page'])) {
            $dataPage = $page->getDataPage($_GET['page']);
        } else {
            $dataPage = $page->getDataPage(1);
        }

        if (empty($dataPage)) {
            echo '<tr><td colspan="9">No data!</td></tr>';
        } else {
            foreach ($dataPage as $key => $app) {
                ?>
                <tr>
                    
                    <td><?php echo $app->getId(); ?></td>
                    <td><?php echo $app->getTitle(); ?></td>
                    <td><img src="<?php echo URL_BASE . '/' . $app->getImages(); ?>" width="100" height="100" alt="No Img" title="<?php echo $app->getDescription(); ?>"/></td>
                    <td><?php echo $app->getUpdatetime(); ?></td>
                    <td><?php echo $app->getVersion(); ?></td>
                    <td><?php echo $app->getRequirement(); ?></td>
                    <td><?php echo $app->getCategory_id(); ?></td>
                    <td><?php echo $app->getSize(); ?></td>
                    <td><?php echo $app->getLink(); ?></td>
                    <td><?php echo $app->getPoint(); ?></td>
                    <td>
                        <a href="<?php echo URL_BASE ?>/admin/apps/form?app_id=<?php echo $app->getId() ?>&page=<?php echo $_GET['page'] ?>">Sửa</a> | 
                        <a href="<?php echo URL_BASE ?>/admin/apps/delete?app_id=<?php echo $app->getId() ?>&page=<?php echo $_GET['page'] ?>" onclick="return confirm('Delete?');">Xóa</a>
                    </td>
                </tr>
                <?php
            }
        }
        ?>
    </tbody>
</table>
<?php
if ($page->numPage() > 1) {
    $url = URL_BASE . '/admin/apps/index';
    echo $page->viewNumPage($url);
}
?>
